begintownscript;

variables;
short bmessage,pcs,seated,leadchar,rctx,rcty,r_u_dum;
string custom_m;

body;

beginstate INIT_STATE;
	turn_off_training(1);

	set_incidental_sound(0);
	set_char_dialogue_pic(6,1957,0);
	set_crime_tolerance(1);
	r_u_dum = 0;
	if(get_flag(83,0) < 11){
		force_instant_terrain_redraw();
		pause(6);
		reset_dialog();
		add_dialog_str(0,"...what the hell is going on?",0);
		if(party_size() == 1){
			add_dialog_str(1,"Now, I have to admit the behavior of the brigands has been inconsistent with their usual methods, but they never were so intensely organized.",0);
			add_dialog_str(2,"As of now, however, the brigands have set themselves up like a stopper in a bottleneck to impede my progress.  But nevermind that, they aren't even attacking me.  Why?",0);
		}
		if(party_size() > 1){
			add_dialog_str(1,"Now, it's true that the behavior of the brigands has been inconsistent with their usual methods, but they never were so intensely organized.",0);
			add_dialog_str(2,"As of now, however, the brigands have set themselves up like a stopper in a bottleneck to impede our progress.  But nevermind that, they aren't even attacking us.  Why?",0);
		}
		add_dialog_str(3,"The commander in the front doesn't lift a finger and speaks to me in a dreary monotone:",0);
		add_dialog_str(4,"_The master is away.  We were ordered to prevent you from entering, but not to engage you until his return._",0);
		add_dialog_str(5,"What the hell is going on?",0);
		bmessage = run_dialog(1);

		set_flag(83,0,11);
	}

break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;

	if(get_crime_level() == 0){
		if(r_u_dum < 21)
			r_u_dum = (r_u_dum + 1);
		if(r_u_dum == 20){
			if(party_size() == 1)
				message_dialog("What am I supposed to do now?  I mean, there's no way I can get through here without killing murderous brigands...","Man oh man, what a quandary.");
			if(party_size() > 1)
				message_dialog("What are we supposed to do now?  There's no way we can get through here without killing murderous brigands...","Man oh man, what a quandary.");
		}
	}

break;

beginstate 10;
break;

beginstate 30;

	if((get_flag(11,1) >= 2) && (get_flag(12,1) == 0)){
		if(party_size() == 1)
			message_dialog("Captain Andre was right-- the key is very well hidden.  Fortunately, I know where it is, making it that much easier to take.","Now, to commandeer one of the boats outside.");
		if(party_size() > 1)
			message_dialog("Captain Andre was right-- the key is very well hidden.  Fortunately, we know where it is, making it that much easier to take.","Now, to commandeer one of the boats outside.");
		change_spec_item(3,1);
		set_flag(12,1,1);
	}

break;

beginstate 31;

	if(is_combat() == TRUE){
		block_entry(1);
		end();
	}
	if((get_flag(11,1) >= 2) && (get_flag(12,1) >= 1)){
		reset_dialog();
		if(party_size() == 1){
			add_dialog_str(0,"Well, this is it.  This is the boat that will take me to battle an Imperial General's elite army.  The question is, am I ready to meet him?",0);
			add_dialog_choice(0,"I'm ready.");
		}
		if(party_size() > 1){
			add_dialog_str(0,"Well, this is it.  This is the boat that will take us to battle an Imperial General's elite army.  The question is, are we ready to meet him?",0);
			add_dialog_choice(0,"We're ready.");
		}
		add_dialog_choice(1,"No, not yet...");
		bmessage = run_dialog(0);
		if(bmessage == 2)
			end();

		pcs = 0;
		seated = 0;
		while(pcs <= 3){
			if(char_ok(pcs) == TRUE){
				set_character_facing(pcs,0);
				if(seated == 0)
					relocate_character(pcs,11,27);
				if(seated == 1)
					relocate_character(pcs,10,26);
				if(seated == 2)
					relocate_character(pcs,12,26);
				if(seated == 3)
					relocate_character(pcs,9,26);
				seated = (seated + 1);
			}

			pcs = (pcs + 1);
		}

		force_view_center(11,27);
		force_instant_terrain_redraw();
		pause(5);

		set_terrain(10,29,336);
		set_terrain(11,29,336);
		set_terrain(12,29,336);
		force_instant_terrain_redraw();
		play_sound(99);
		pause(5);

		message_dialog("Here goes nothing...","Onward, to the Red Fortress.");

		rcty = 26;
		while(rcty >= 4){
			force_view_center(11,rcty);
			force_instant_terrain_redraw();
			pause(1);

			rcty = (rcty - 1);
		}

		move_to_new_town(21,22,12);
	}

break;

beginstate 32;

	if(is_combat() == TRUE){
		block_entry(1);
		end();
	}
	if((get_flag(11,1) >= 2) && (get_flag(12,1) >= 1)){
		reset_dialog();
		if(party_size() == 1){
			add_dialog_str(0,"Well, this is it.  This is the boat that will take me to battle an Imperial General's elite army.  The question is, am I ready to meet him?",0);
			add_dialog_choice(0,"I'm ready.");
		}
		if(party_size() > 1){
			add_dialog_str(0,"Well, this is it.  This is the boat that will take us to battle an Imperial General's elite army.  The question is, are we ready to meet him?",0);
			add_dialog_choice(0,"We're ready.");
		}
		add_dialog_choice(1,"No, not yet...");
		bmessage = run_dialog(0);
		if(bmessage == 2)
			end();

		pcs = 0;
		seated = 0;
		while(pcs <= 3){
			if(char_ok(pcs) == TRUE){
				set_character_facing(pcs,0);
				if(seated == 0)
					relocate_character(pcs,21,27);
				if(seated == 1)
					relocate_character(pcs,20,26);
				if(seated == 2)
					relocate_character(pcs,22,26);
				if(seated == 3)
					relocate_character(pcs,19,26);
				seated = (seated + 1);
			}

			pcs = (pcs + 1);
		}

		force_view_center(21,27);
		force_instant_terrain_redraw();
		pause(5);

		set_terrain(20,29,336);
		set_terrain(21,29,336);
		set_terrain(22,29,336);
		force_instant_terrain_redraw();
		play_sound(99);
		pause(5);

		message_dialog("Here goes nothing...","Onward, to the Red Fortress.");

		rcty = 26;
		while(rcty >= 4){
			force_view_center(21,rcty);
			force_instant_terrain_redraw();
			pause(1);

			rcty = (rcty - 1);
		}

		move_to_new_town(21,22,12);
	}

break;

